<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查询</title>
    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="css/common.css">
    <link rel="stylesheet" type="text/css" href="css/index.css">


    <script src="js/getParameter.js"></script>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-3.3.1.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <!--导入布局js，共享header和footer-->
    <script type="text/javascript" src="js/include.js"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<script>
    $(function () {
    //添加绑定单击事件  模糊查询
    /*$("#ss").click(function () {*/
        var rname = getParameter("rname");
        /*alert("开始"+rname);*/
        //判断rname如果不为null或者""
        if(rname){
            //url解码
            rname = window.decodeURIComponent(rname);

        }
       /* alert("传输前"+rname);*/
       /* var srnr = $("#name").val();*/
        /*alert("Text: " + srnr);*/

        /*alert(name1.val())*/
        load(rname);
    });

    function load(rname) {
       /* alert("get开始前"+rname)*/
        //发送ajax请求，请求route/pageQuery,传递cid
        $.get("mmohuchaxunServlet", {name: rname}, function (data) {
            var alls = "";
            for (var i = 0; i < data.length; i++) {
                alls = "<tr>\n" +
                    "            <td>"+data[i].id+"</td>\n" +
                    "            <td>"+data[i].name+"</td>\n" +
                    "            <td>"+data[i].amount+"</td>\n" +
                    "            <td>"+data[i].price+"</td>\n" +
                    "            <td>"+data[i].productionDate+"</td>\n" +
                    "            <td>"+data[i].shelflife+"</td>\n" +
                    "            <td>"+data[i].manufacturer+"</td>\n" +
                    "            <td>"+data[i].phone+"</td>\n" +
                    "        </tr>"

                $("#FindAllFandV").append(alls)

            }
        })
    }


    /*})
*/
</script>
</head>
<body>
<div id="header"></div>
<div style="width: 1000px ;margin: 15px auto"><form class="form-inline">
    <div  class="form-group">
       <!-- <label for="name">按名称查询：</label>
        <input type="text" name="name"  class="form-control" id="name" placeholder="如：苹果">
        <button  id="ss" name="ss" type="button" class="btn btn-default">查询</button>-->
    </div>
</form></div>
<!--<div style="width: 1000px ;margin: 15px auto">
    <button id="tianjia" style="float:right;width: 150px" type="submit" class="btn btn-primary">产品添加</button>
</div>-->
<div style="width: 1200px ;margin: 15px auto" >
    <table id="FindAllFandV" class="table table-bordered"width="400">
        <tr>
            <th>编号</th>
            <th>商品名称</th>
            <th>数量(kg)</th>
            <th>价格(元)/kg</th>
            <th>生产日期</th>
            <th>保质期(天)</th>
            <th>供货商</th>
            <th>电话号码</th>
        </tr>
        <tr >
            <!--<td>编号</td>
            <td>商品名称</td>
            <td>数量</td>
            <td>价格</td>
            <td>生产日期</td>
            <td>保质期</td>
            <td>供货商</td>
            <td>电话号码</td>-->
        </tr>
    </table>

</div>
</body>
</html>